import hashlib
import markdown


def sha512(s):
    res = hashlib.sha512()
    res.update(s.encode("utf-8"))
    return res.hexdigest()


def markdown_to_html(s):
    exts = ["markdown.extensions.extra",
            "markdown.extensions.admonition",
            "markdown.extensions.codehilite",
            "markdown.extensions.meta",
            "markdown.extensions.nl2br",
            "markdown.extensions.sane_lists",
            "markdown.extensions.smarty",
            "markdown.extensions.toc",
            "markdown.extensions.wikilinks"
           ]
    return markdown.markdown(s, extensions=exts)
